<template>
  <div>
    <header class="header">
      <h1>todos</h1>
      <input
        class="new-todo"
        autofocus
        autocomplete="off"
        placeholder="What needs to be done?"
        v-model="text"
        @keyup.enter="addClk"
      />
    </header>
  </div>
</template>

<script>
import { mapActions } from "vuex";
export default {
  data() {
    return {
      text: "",
    };
  },
  methods: {
    ...mapActions("todolist", ["addToList"]),
    addClk() {
      if (!this.text) return;
      this.addToList({
        text: this.text,
        isIptShow: false,
        isCheck: false,
      });
      this.text = "";
    },
  },
};
</script>

<style scoped></style>
